package com.leading.spring.consumer.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @author chennan
 * @create 2021-05
 */
@Configuration
public class ConsumerConfiguration {
    /* 顶级接口 轮询规则
    com.netflix.loadbalancer.IRule
    RoundRobinRule  轮询
    RandomRule  随机
    AvailabilityFilteringRule：会先过滤掉，跳闸，访问故障的服务，对剩下的进行轮询


     */
    //
    //


    //配置负载均衡实现 RestTemplate
    @Bean
    @LoadBalanced //Ribbon
    public RestTemplate getRestTemplate() {
        return new RestTemplate();
    }

}
